package com.example.demo.validation;

import jakarta.validation.ConstraintValidator;
import jakarta.validation.ConstraintValidatorContext;

public class SHAHashValidator implements ConstraintValidator<ValidSHAHash, String> {

	@Override
	public void initialize(ValidSHAHash constraintAnnotation) {
	}

	@Override
	public boolean isValid(String value, ConstraintValidatorContext context) {
		if (value == null) {
			return false;
		}
		return value.matches("^[a-fA-F0-9]{64}$");
	}
}
